package sd.czw.com.mmgapp;
import android.app.Application;

import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.zhy.http.okhttp.OkHttpUtils;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * Created by czw
 * desc 描述：
 * on 2017/7/5.
 */
public class MieMieGouApplication extends Application {
    private static MieMieGouApplication instance;
    @Override
    public void onCreate() {
        super.onCreate();
        if (instance == null) {
            instance = this;
        }

        IWXAPI api = WXAPIFactory.createWXAPI(getApplicationContext(), null);
        // 将该app注册到微信
        api.registerApp(Contants.APP_ID);

        //post请求
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
//                .addInterceptor(new LoggerInterceptor("TAG"))
                .connectTimeout(5000L, TimeUnit.MILLISECONDS)
                .readTimeout(5000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();
        OkHttpUtils.initClient(okHttpClient);
    }

    public static MieMieGouApplication getInstance() {
        return instance;
    }
}
